/*
 * @Author: chenbolin@msn.cn
 * @Date: 2023-02-27 14:45:39
 * @LastEditors: chenbolin@msn.cn
 * @LastEditTime: 2023-10-05 15:49:13
 * @FilePath: \multifunctional\src\App\Joystick.h
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
 */
#ifndef JOYSTICK_H
#define JOYSTICK_H

#include "Sys.h"

typedef enum
{
    JOYSTICK_ERR_NONE = 0,
    JOYSTICK_ERR_DISCONNECTED,
    JOYSTICK_ERR_NOT_ZEROED
} JoystickErrorID_t;

typedef struct
{
    SysJoystickChannel_t ch;
    JoystickErrorID_t error;
}JoystickErrorReport_t;

bool JoystickIsReady(void);
void JoystickReset(void);
unsigned char JoystickGetPercent(SysJoystickChannel_t ch, SysJoystickDirect_t dir);
unsigned short JoystickGetRawValue(SysJoystickChannel_t ch, SysJoystickDirect_t dir);
JoystickErrorReport_t *JoystickErrorCheck(void);
void JoystickInitialize(void);
void JoystickPoll(void);

#endif
